<template>
	<text>{{distanceDistance}}</text>
</template>

<script>
	export default {
		name: "distance-format",
		data() {
			return {
				distanceDistance: ''
			};
		},
		props: {
			distance: [Number]
		},
		computed: {
			//格式化距离显示

		},
		mounted() {
			if (parseFloat(this.distance) > 1000) {
				this.distanceDistance = ((this.distance) / 1000).toFixed(1) + 'km'
			} else {
				this.distanceDistance = (parseFloat(this.distance).toFixed(0)) + 'm'
			}
		}
	}
</script>

<style>

</style>